package com.ctv.my.customview;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import com.ctv.my.customview.BaiajCustomView.activities.BaiajMainAct;
import com.ctv.my.customview.MaiCustomView.MaiActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private Button btnGotoBaiaj;
    private Button btnGotoMesson;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        init();
    }

    private void init() {
        initView();
        initEvent();
    }

    private void initView() {
        btnGotoBaiaj = (Button) findViewById(R.id.btn_goto_baiaj);
        btnGotoMesson = (Button) findViewById(R.id.btn_goto_messon);
    }

    private void initEvent() {
        btnGotoBaiaj.setOnClickListener(this);
        btnGotoMesson.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        if (view.getId() == R.id.btn_goto_baiaj){
            gotoAct(BaiajMainAct.class);
        }else {
            gotoAct(MaiActivity.class);
        }
    }

    private void gotoAct(Class<?> cls){
        Intent intent = new Intent(this, cls);
        startActivity(intent);
    }

}

